#include <iostream>
#include <iomanip>
using namespace std;

int maze[10][12] = {0};
int road[80][2] = {0};
int roadindex = 0;
int count = 0;

void draw()
{
    cout << "  ";
    for(int i=0; i<12; i++)
    {
        cout << i << setw(2);
    }
    cout << endl;
    for(int i = 0; i<10; i++)
    {
        cout << i;
        for(int j = 0; j < 12; j++)
        {
            if(maze[i][j] == 0)
            {
                cout << "墙";
            }
            else if(maze[i][j] == 1)
            {
                cout << "空";
            }
            else
            {
                cout << "路";
            }
        }
        cout << endl;
    }
}

bool find(int i, int j)
{
    bool found = false;
    if(i + 1 == 9 && j == 10 || i == 9 && j+1 == 10)
    {
        road[roadindex][0] = j;
        road[roadindex][1] = i;
        return true;
    }
    else
    {
        if(maze[i+1][j] != 0)
        {
            found = find(i+1, j);
        }
        if (maze[i][j+1] != 0)
        {
            found = find(i , j+1);
        }
        if (maze[i-1][j] != 0)
        {
            found = find(i, j+1);
        }
        if (maze[i, j-1] != 0)
        {

        }
    }
}

int main()
{
    int x, y;
    bool found;
    draw();
    cout << "请输入迷宫“路”的坐标，输入“0, 0”结束输入" << endl;
    while(cin >> x >> y)
    {
        if(x == 0 && y == 0)
        {
            break;
        }
        maze[y][x] = 1;
        draw();
    }
    find(1, 1);
}